<html>
    <head>
        <title>promise test</title> 
        <script src="./MyPromise.js"></script>
    </head>
    <body>
        <script>
            let promise = new MyPromise((resolve, reject) => {
                // console.log(test); //测异常捕获
                setTimeout(() =>{
                    resolve('解决'); 
                //   reject('拒绝');
                }, 1000)    
            }).then(value => {
                console.log(value)
            })
            // .then()//测试then不做任何函数处理
            // .then(
            //     value => {
            //         console.log(value) //测试then方法异常
            //         return 'success'
            //     }, 
            //     reason => {
            //         console.log(reason)
            //         return 'fail'
            //     }
            // ).then(value => {
            //     console.log('res:'+value)
            // }, reason => {
            //     console.log('Error:'+reason)
            // })

            // console.log(promise)
        </script>
    </body>
</html>